
let axios = require('axios');

function loadText(filepath) {
    return new Promise((resolve, reject) => {
        axios.get(filepath, {
            // config
            method: 'get',
            responseType: 'text',

            // @ts-ignore
            responseEncoding: 'utf8',
        }).then((resp) => {
            console.log(`load ${filepath} success!`);
            resolve(resp.data);
        }).catch(err => {
            console.error('err:', err);
            reject(filepath);
        });
    });
}
module.exports = {
    loadText:loadText,
};
